#include "geometryobjects.h"

bool GeometryObjects::m_initialized = false;

void GeometryObjects::init()
{
	if(GeometryObjects::m_initialized)
		return;

	m_captions = new Captions();
	m_colorbars = new ColorBars();
	m_hitpoints = new HitPoints();
	m_paths = new Paths();
	m_crops = new Crops();
	m_pathgroups = new PathGroups();
	m_paintball = new PaintBall();
	m_trisets = new Trisets();
	m_networks = new Networks();
	m_clipplanes = new ClipPlanes();
	m_initialized = true;
}

Captions* GeometryObjects::m_captions = NULL;
Captions* GeometryObjects::captions() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_captions; 
}

ColorBars* GeometryObjects::m_colorbars = NULL;
ColorBars* GeometryObjects::colorbars() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_colorbars; 
}

HitPoints* GeometryObjects::m_hitpoints = NULL;
HitPoints* GeometryObjects::hitpoints() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_hitpoints; 
}

Paths* GeometryObjects::m_paths = NULL;
Paths* GeometryObjects::paths() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_paths; 
}

Crops* GeometryObjects::m_crops = NULL;
Crops* GeometryObjects::crops() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_crops; 
}

PathGroups* GeometryObjects::m_pathgroups = NULL;
PathGroups* GeometryObjects::pathgroups() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_pathgroups; 
}

PaintBall* GeometryObjects::m_paintball = NULL;
PaintBall* GeometryObjects::paintball() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_paintball; 
}

Trisets* GeometryObjects::m_trisets = NULL;
Trisets* GeometryObjects::trisets() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_trisets; 
}

Networks* GeometryObjects::m_networks = NULL;
Networks* GeometryObjects::networks() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_networks; 
}

ClipPlanes* GeometryObjects::m_clipplanes = NULL;
ClipPlanes* GeometryObjects::clipplanes() 
{ 
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	return m_clipplanes; 
}

bool GeometryObjects::inPool = false;
bool GeometryObjects::showGeometry = true;

void
GeometryObjects::removeFromMouseGrabberPool()
{
  if(!GeometryObjects::m_initialized) GeometryObjects::init();
  m_trisets->removeFromMouseGrabberPool();
  m_networks->removeFromMouseGrabberPool();
  m_paths->removeFromMouseGrabberPool();
  m_pathgroups->removeFromMouseGrabberPool();
  m_crops->removeFromMouseGrabberPool();
  m_clipplanes->removeFromMouseGrabberPool();
}

void
GeometryObjects::addInMouseGrabberPool()
{
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
    m_trisets->addInMouseGrabberPool();
    m_networks->addInMouseGrabberPool();
    m_paths->addInMouseGrabberPool();
    m_pathgroups->addInMouseGrabberPool();
    m_crops->addInMouseGrabberPool();
    m_clipplanes->addInMouseGrabberPool();
}

void
GeometryObjects::show()
{
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	m_networks->show();
	m_clipplanes->show();
	m_crops->show();
}

void
GeometryObjects::hide()
{
	if(!GeometryObjects::m_initialized) GeometryObjects::init();
	m_networks->hide();
	m_clipplanes->hide();
	m_crops->hide();
}
